<template>
  <div class="member-order-detial">
    <!-- 头部 -->
    <DetailAction :order="order" />
    <!-- /头部 -->

    <!-- 进度 -->
    <DetailSteps :order="order" />
    <!-- /进度 -->

    <!-- 物流  -->
    <suspense>
      <template #default>
        <DetailLogistics v-if="[3,4,5].includes(order.orderState)" :order="order" />
      </template>
      <template #fallback>
        loading...
      </template>
    </suspense>
    <!-- /物流 -->

    <!-- 信息 -->
    <OrderInfo :order="order" />
    <!-- /信息 -->
  </div>
</template>

<script>
import { ref } from 'vue'
import DetailAction from './components/detail-action'
import DetailSteps from './components/detail-steps'
import DetailLogistics from './components/detail-logistics'
import OrderInfo from './components/detail.info'
import { findOrderDetail } from '@/api/order'
import { useRoute } from 'vue-router'
export default {
  name: 'MemberDetial',
  components: {
    DetailAction,
    DetailSteps,
    DetailLogistics,
    OrderInfo
  },
  setup () {
    const route = useRoute()

    const order = ref(null)
    findOrderDetail(route.params.id).then(data => {
      order.value = data.result
    })
    return { order }
  }
}
</script>

<style lang="less" scoped>
.member-order-detial {
  background-color: #fff;
  height: 100%;
}
</style>
